<script type="text/javascript">
$(function(){
	var fileName="";
	$.get("printCredentials/getPDFInfo",function(data){
		console.log(data)
		//	alert("data.credential_type:"+data.credential_type);
		//	alert("data.credentialNo:"+data.credentialNo);
			var type = "";
			if(data.credential_type && data.credential_type!="storage"){
				type = data.credential_type;
			}
			$("input[name='type']").val(type);
			$("input[name='cert_no']").val(data.ticket.cert_no);
			$("input[name='bussiness_type']").val(data.ticket.bussiness_type);
			$("input[name='card_type']").val(data.ticket.card_type);
			$("input[name='branchNo']").val(data.ticket.branchNo);
			$("input[name='operatorNo']").val(data.ticket.operatorNo);
			$("input[name='operateDate']").val(data.ticket.operateDate);
			$("input[name='cardpName']").val(data.ticket.cardpName);
			$("input[name='card_no']").val(data.ticket.card_no);
			$("input[name='old_card_no']").val(data.ticket.old_card_no);
			$("input[name='new_card_no']").val(data.ticket.new_card_no);
			$("input[name='cardDeposit']").val(data.ticket.cardDeposit);
			$("#corpNamePDF").val(data.ticket.corpName);
			$("input[name='recordNum']").val(data.ticket.recordNum);
			$("input[name='current_balance']").val(data.ticket.current_balance);
			$("input[name='reChargeMoney']").val(data.ticket.reChargeMoney);
			$("input[name='afterRecharge']").val(data.ticket.afterRecharge);
			$("input[name='logoffTotalMoney']").val(data.ticket.operateTime);
			$("input[name='logoffTotalMoney']").val(data.ticket.logoffTotalMoney);
			var html_pdf = '<object data ="'
							+data.path
							+'" type="application/pdf" width="100%" height="95%">'
							+'<iframe src="'
							+data.path
							+'" width="100%" height="95%" style="border: none;">'
							+'This browser does not support PDFs. Please download the PDF to view '
							+'it: <a href="">Download PDF</a>'
							+'</iframe>'
							+'</object>'; 
			$("#pdfView").append(html_pdf);
			/*  var html_pdf = '<object data ="http://127.0.0.1:9999/qzsmk/resource/credentials/KC00000001_print.pdf" type="application/pdf" width="100%" height="95%">'
				+'<iframe src="http://127.0.0.1:9999/qzsmk/resource/credentials/KC00000001_print.pdf" width="100%" height="95%" style="border: none;">'
				+'This browser does not support PDFs. Please download the PDF to view '
				+'it: <a href="">Download PDF</a>'
				+'</iframe>'
				+'</object>';  
			$("#pdfView").append(html_pdf); */
			
			
			
			
			//$("object").attr("data","D:\\template\\"+item.credential_type+item.cardNo+"_print.pdf");
			//$("iframe").replaceAll("#pdf#",item.credential_type+item.cardNo+"_print.pdf");
	},"json");
	
	$("#printCredential").click(function(){
		var type=$("input[name='type']").val();
		var certNo=$("input[name='cert_no']").val();
		var bussinessType=$("input[name='bussiness_type']").val();
		var cardType=$("input[name='card_type']").val();
		var branchNo=$("input[name='branchNo']").val();
		var operatorNo=$("input[name='operatorNo']").val();
		var operateDate=$("input[name='operateDate']").val();
		var cardpName=$("input[name='cardpName']").val();
		var cardNo=$("input[name='card_no']").val();
		var oldCardNo=$("input[name='old_card_no']").val();
		var newCardNo=$("input[name='new_card_no']").val();
		var cardDeposit=$("input[name='cardDeposit']").val();
		var corpName=$("input[name='corpName']").val();
		var recordNum=$("input[name='recordNum']").val();
		var currentBalance=$("input[name='current_balance']").val();
		var reChargeMoney=$("input[name='reChargeMoney']").val();
		var afterRecharge=$("input[name='afterRecharge']").val();
		var operateTime=$("input[name='operateTime']").val();
		var logoffTotalMoney=$("input[name='logoffTotalMoney']").val();
		console.log("type===>"+type);
		var Tickettype;
		var Ticketdata;
		if("lossRegister"==type||"lossCancel"==type||"changeCardRegister"==type||"supplierCardRegister"==type){
		 Tickettype=1;
		 Ticketdata=certNo+","+bussinessType+","+cardType+","+cardNo+","+branchNo+","+operatorNo+","+operateDate;
		}else if("applyRegister"==type){
		 Tickettype=4;
		 Ticketdata=certNo+","+bussinessType+","+cardType+","+cardpName+","+branchNo+","+operatorNo+","+operateDate;	
		}else if("changeAndRelease"==type||"supplierAndRelease"==type){
		 Tickettype=2;
		 Ticketdata=certNo+","+bussinessType+","+cardType+","+oldCardNo+","+newCardNo+","+cardDeposit+","+branchNo+","+operatorNo+","+operateDate;		
		}else if("applyRelease"==type||"sellCard"==type){
		 Tickettype=3;
		 Ticketdata=certNo+","+bussinessType+","+cardType+","+cardNo+","+cardDeposit+","+branchNo+","+operatorNo+","+operateDate;		
		}else if("applyBatchRegister"==type){
		 Tickettype=7;
		 Ticketdata=certNo+","+bussinessType+","+corpName+","+cardpName+","+recordNum+","+cardDeposit+","+branchNo+","+operatorNo+","+operateDate;		
		}else if("batchCard"==type){
		 Tickettype=6;
		 Ticketdata=certNo+","+bussinessType+","+corpName+","+cardpName+","+recordNum+","+branchNo+","+operatorNo+","+operateDate;		
		}else if("EPPay"==type){
		 Tickettype=5;
		 Ticketdata=certNo+","+bussinessType+","+cardType+","+cardNo+","+currentBalance+","+reChargeMoney+","+afterRecharge+","+branchNo+","+operatorNo+","+operateTime;		
		}else if("openApp"==type){
		 Tickettype=8;
		 Ticketdata=certNo+","+bussinessType+","+cardType+","+cardNo+","+logoffTotalMoney+","+cardDeposit+","+branchNo+","+operatorNo+","+operateTime;		
		}else if("logoffCardRegister"==type||"openAndCloseApp"==type||"cancelRefund"==type){
		 Tickettype=9;
		 Ticketdata=certNo+","+bussinessType+","+cardType+","+cardNo+","+cardDeposit+","+logoffTotalMoney+","+branchNo+","+operatorNo+","+operateTime;		
		}
		console.log("tTicketdataype===>"+Ticketdata);
		printocx.printCardTicket(Tickettype,Ticketdata);
	});
	//location.reload();

})


</script>
<!-- 方法1  -->
<!-- <embed src="app_cert_print.pdf" type="application/pdf" width="100%" height="100%"> -->

<!-- 方法2 如果浏览器不支持PDF，那么给到链接可以下载 -->
<div class="pageContent">
	<form method="post" action="demo/common/ajaxDone.html" class="pageForm">
	<div class="pageFormContent" layoutH="56">
		<div id="pdfView" layout="56" style="height:500px">
		    <input name="type" type="hidden">
			<input name="cert_no" type="hidden">
			<input name="bussiness_type" type="hidden">
			<input name="card_type" type="hidden">
			<input name="branchNo" type="hidden">
			<input name="operatorNo" type="hidden">
			<input name="operateDate" type="hidden">
			<input name="cardpName" type="hidden">
			<input name="card_no" type="hidden">
			<input name="old_card_no" type="hidden">
			<input name="new_card_no" type="hidden">
			<input name="cardDeposit" type="hidden">
			<input id="corpNamePDF" name="corpName" type="hidden"> 
			<input name="recordNum" type="hidden">
			<input name="current_balance" type="hidden">
			<input name="reChargeMoney" type="hidden">
			<input name="afterRecharge" type="hidden"> 
			<input name="operateTime" type="hidden">
			<input name="logoffTotalMoney" type="hidden">
		</div>
		
				<!-- <object type="application/pdf" width="100%" height="95%">
				<iframe src="" width="100%" height="95%" style="border: none;">
				This browser does not support PDFs. Please download the PDF to view it: <a href="">Download PDF</a>
				</iframe>
				</object> -->
		<div class="formBar">
			<ul>
				<li>
					<div class="button"><div class="buttonContent"><button type="button" id="printCredential">打印</button></div></div>
				</li>
				<li>
					<div class="button"><div class="buttonContent"><button type="button" class="close">关闭</button></div></div>
				</li>
			</ul>			
		</div>
	</div>
	</form>
</div>